package com.ruoyi.system.config;

import com.ruoyi.system.service.impl.SysConfigServiceImpl;
import com.ruoyi.system.service.impl.SysDictTypeServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationListener;
import org.springframework.context.event.ContextRefreshedEvent;
import org.springframework.stereotype.Component;

@Component
public class RuntimeConfig implements ApplicationListener<ContextRefreshedEvent> {

    @Autowired
    private SysConfigServiceImpl sysConfigService;

    @Autowired
    private SysDictTypeServiceImpl sysDictTypeService;

    @Override
    public void onApplicationEvent(ContextRefreshedEvent event) {
        sysConfigService.loadingConfigCache();
        sysDictTypeService.loadingDictCache();
    }
}
